<template>
  <div>
    <!-- 面包屑导航 -->
    <el-breadcrumb separator="/">
      <el-breadcrumb-item :to="{ path: '/' }">职称申报管理</el-breadcrumb-item>
      <el-breadcrumb-item>
        <a href="/">职称申报</a>
      </el-breadcrumb-item>
    </el-breadcrumb>
    <!-- 下面的内容 -->

    <el-button type="primary" @click="dialogVisible = true" class="add_btn_css">职称申报</el-button>
    <!-- 提示弹出框 -->
    <el-dialog  :visible.sync="dialogVisible" width="35%">
      <p style="font-size: 24px; text-align:center; margin-bottom:20px">个人申报专业技术资格诚信承诺书</p>
      <p style="text-indent:2em; border-top:1px solid #eee; padding-top:20px; font-size:16px; line-height:30px">本人承诺所提交的所有评审材料（包括学历、职称、奖励证书及论文、业绩证明等材料）均为真实。如材料提供虚假、失实，本人自愿五年内停止申报专业技术资格，并接受人社等部门的处理。</p>
      <span slot="footer" class="dialog-footer">
        <el-button @click="dialogVisible = false">取 消</el-button>
        <el-button type="primary" @click="inforOk">确 定</el-button>
      </span>
    </el-dialog>
    <!-- 表格 -->
    <el-container>
      <el-table :data="tableData" style="width: 100%" :header-cell-style="rowClass">
        <el-table-column type="index" label="编号" width="50"></el-table-column>
        <el-table-column prop="year" label="年度" width="120"></el-table-column>
        <el-table-column prop="declarationTime" label="申报时间" width="150"></el-table-column>
        <el-table-column prop="specialSkillLevel" label="申报级别" width="200"></el-table-column>
        <el-table-column prop="nameOfSpecialSkillDeclaration" label="申报资格名称" width="330"></el-table-column>
        <el-table-column prop="approvalStatus" label="审批状态" width="120"></el-table-column>
        <el-table-column label="操作">
          <template slot-scope="scope">
            <el-button @click="handleClick(scope.row)" plain size="small" class="btn_css_er">查看</el-button>
          </template>
        </el-table-column>
      </el-table>
    </el-container>
      <!-- 分页 -->
    <div class="block page_css">
      <el-pagination 
      layout="prev, pager, next" 
      :total="total"
      :page-size="limit"
      @current-change="change"
      @prev-click="prev"
      @next-click="next"
      ></el-pagination>
    </div>
  </div>
</template>
<script>
export default {
  data() {
    return {
      documentNumber: "123x456789", 
      page:1,
      limit:5,
      total:0,
      dialogVisible: false,
      tableData: []
    };
  },

  methods: {
    /* 页面渲染 */
    getCon(){
      this.$axios({
        url:'/PTDF/list',
        method:'post',
        data:{
          documentNumber: this.documentNumber,
          page: this.page,
          limit: this.limit,
        }
      }).then(res => {
        // console.log(res.data.data);
        this.tableData = res.data.data;
        this.total = res.data.count;
      })
    },
    /* 分页渲染 */
    change(page){
      this.page = page;
      this.getCon();
    },
    prev(){
      this.page--;
      this.getCon();
    },
    next(){
      this.page++;
      this.getCon();
    },
    inforOk(){
        this.dialogVisible= false;   
        this.$router.push('/personalinformation/declareinformation')
    },
    handleClick(row) {
      console.log(row);
      this.$router.push('/personalinformation/checkprocess')
    },


    /* 改变表头背景颜色 */
    rowClass() {
      return "background:#F4F4F4;";
    }
  },
  mounted(){
    this.getCon();
    sessionStorage.setItem('fName', 'JobTitleDeclare');
  }
};
</script>
<style scoped lang="less">
.el-table {
  font-size: 13px;
  padding: 20px;
  margin-right: 80px;
}
.page_css {
  margin: 10px;
  text-align: right; 
  margin-right: 80px;
}
.btn_css_er {
  background-color: #f7f7f7;
  border: 1px solid #eee;
  width: 60px;
  height: 30px;
  text-align: center;
}
.add_btn_css {
  margin: 20px 0;
}
.el-table__header,
.el-table__header-wrapper,
.has-gutter {
  background-color: #eee;
}
</style>